Machine vision systems are known and widely in use for numerous inspection applications, including inspection of solder paste on printed circuit boards, location of defects on printed labels, and inspection of adhesives on a die, or the like. In many such automated inspection applications a basic issue addressed in the inspection process is a determination of the presence/absence, or measurement of a feature of interest (called the "foreground"), e.g. solder or adhesive, within the context of a complex background. Complex backgrounds, e.g. the surface of a printed circuit board or a label or die, may include various geometric configurations, great variability in darkness and brightness, and/or light reflection and/or shadowing. Intricate backgrounds with a variety of gray levels, for example solder pads and board surface, and/or different polarities with respect to paste gray level values, make it difficult for the inspection system to discern the features of interest from the complexities of the background.
Segmentation is an important concept applied in machine vision for various inspection/location applications, such as those requiring the location/inspection of features of interest in complex backgrounds. Segmentation generally means discriminating (or segmenting) an image involved in a machine vision process into features of interest (i.e. foreground) and background, on a pixel by pixel basis.
Various techniques are known, and others have been proposed, for implementing segmentation in machine vision applications. Some segmentation implementations, such as those described in Gonzalez & Wintz, Digital Image Processing, Second Edition Section 7.3, pages 354-367, Addison-Wesley, 1987 involve computing histograms and then deriving suitable thresholds to segment the image. That is, the image is processed on a pixel by pixel basis to determine gray level values for the pixels, and the image pixels are correlated in accordance with frequency of occurrence of particular gray level values. A suitable fixed threshold in the form of a simple scalar value is ascribed to the image, above or below which a pixel will be designated either as a background pixel or as a pixel associated with a feature of interest.
However, segmentation via known thresholding techniques has limited applicability. In many applications the scenes are very complex and are thus not conducive to selection of a particular scalar value for discriminating between background and features of interest. For instance, within an image of an object under inspection there may be pixels relating to features of interest that have virtually the same gray level value as pixels relating to some background aspect. Further there may be a lot of variation of gray level values for pixels related to the same aspect of objects under inspection, from one image to another, so that use of a fixed scalar threshold value results in a particular pixel or set of pixels being designated as background in one image of an object under inspection and as a feature of interest in another image.
Image subtraction can be used to somewhat overcome the problems associated with segmentation of complex scenes. As known in the art, image subtraction is typically implemented in two different ways: in static methods, and in dynamic methods.
In static methods, a run-time image of the object under inspection or part is subtracted from a "golden image," i.e. an image of a known good representation of the part (referred to as a "golden sample"). An example of a static method implementing image subtraction is a label inspection process that uses a "Golden Template Comparison" vision tool as known in the art. Such a process typically involves a golden image of the label under inspection, which is subtracted from a respective image of each label inspected during run time. A respective difference image is used to identify differences between the object/label under inspection and the golden sample. The differences may be quantified as defects.
In dynamic image subtraction methods, two images of the same part taken at two different points in time are subtracted. An example of a dynamic method implementing image subtraction is a solder paste inspection process that uses an image of a printed circuit board ("PCB") captured before solder is applied (a "pre-image"), and an image of the same PCB after solder is applied (a "post-image"), for inspection that determines whether the solder was properly applied to the PCB. The pre-image is subtracted from the post-image so that a respective difference image is generated for each PCB inspected during run time. The difference image is used to identify differences between the pre-image and the post-image, which correspond to areas where solder paste has been applied.
After the image subtraction step, a thresholding step is necessary to binarize the difference image, assigning one value (i.e. "0") to gray values in the difference image that are less than the threshold value (background), and another value (i.e. "1") to gray values in the difference image that are equal to or greater than the threshold value (features of interest or foreground). This is followed by connectivity analysis to complete the segmentation process by relating or connecting adjacent pixels of the same binary value and identifying them as objects of interest or background.
Similar processing is involved in dynamic methods known in the art used for adhesive inspection on a printed circuit board or on a die, and envelope check box content identification which also use multiple images that are a function of multiple light sources.
Disadvantageously, the thresholding step used in known dynamic or static segmentation methods that involve image subtraction typically is achieved by using a simple scalar value as a threshold. In most practical cases this is inadequate and leads to difficulties in discriminating features of interest from background, especially if there is a complex background. Variations in gray level values of similar constructs within a single image and variations in gray level values of the same object from image to image make it difficult to select a single scalar threshold value. Process variations, such as variations in lighting and variations in appearance between objects under inspection, exacerbate the difficulty in locating/inspecting features of interest on complex background(s) using a scalar value threshold.
Similarly, polarities of gray level values of background that are greater or less than the gray level values of features of interest create difficulties in assigning a single threshold value for a given image. In some inspection implementations the background could have areas that are darker and some areas that are brighter than the feature of interest. If contiguous regions are of such opposite polarity, the "edge" or interface between the regions will transition through the gray level(s) of the feature of interest. In particular, in pre-post solder paste inspection implementations, at interface areas or edges where board meets solder pads and the gray value is substantially equal to the gray value of the solder paste, the subtraction operation results in interfaces going undetected, i.e. the areas of edges between the board and pad are effectively ignored.